<?php

/**

 *

 * Show the products in a category

 *

 * @package    VirtueMart

 * @subpackage

 * @author RolandD

 * @author Max Milbers

 * @todo add pagination

 * @link http://www.virtuemart.net

 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.

 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php

 * VirtueMart is free software. This version may have been modified pursuant

 * to the GNU General Public License, and as distributed it includes or

 * is derivative of works licensed under the GNU General Public License or

 * other free or open source software licenses.

 * @version $Id: default.php 6556 2012-10-17 18:15:30Z kkmediaproduction $

 */



//vmdebug('$this->category',$this->category);

vmdebug ('$this->category ' . $this->category->category_name);

// Check to ensure this file is included in Joomla!

defined ('_JEXEC') or die('Restricted access');

JHTML::_ ('behavior.modal');

/* javascript for list Slide

  Only here for the order list

  can be changed by the template maker

*/

$js = "

jQuery(document).ready(function () {

	jQuery('.orderlistcontainer').hover(

		function() { jQuery(this).find('.orderlist').stop().show()},

		function() { jQuery(this).find('.orderlist').stop().hide()}

	)

});

";



$document = JFactory::getDocument ();

$document->addScriptDeclaration ($js);



/*$edit_link = '';

if(!class_exists('Permissions')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'permissions.php');

if (Permissions::getInstance()->check("admin,storeadmin")) {

	$edit_link = '<a href="'.JURI::root().'index.php?option=com_virtuemart&tmpl=component&view=category&task=edit&virtuemart_category_id='.$this->category->virtuemart_category_id.'">

		'.JHTML::_('image', 'images/M_images/edit.png', JText::_('COM_VIRTUEMART_PRODUCT_FORM_EDIT_PRODUCT'), array('width' => 16, 'height' => 16, 'border' => 0)).'</a>';

}



echo $edit_link; */

if (empty($this->keyword)) {

	?>

<div class="category_description">

	<?php echo $this->category->category_description; ?>

</div>

<?php

}



/* Show child categories */



if (VmConfig::get ('showCategory', 1) and empty($this->keyword)) {

	if ($this->category->haschildren) {



		// Category and Columns Counter

		$iCol = 1;

		$iCategory = 1;



		// Calculating Categories Per Row

		$categories_per_row = VmConfig::get ('categories_per_row', 3);

		$category_cellwidth = ' width' . floor (100 / $categories_per_row);



		// Separator

		$verticalseparator = " vertical-separator";

		?>



		<div class="category-view">



		<?php // Start the Output

		if (!empty($this->category->children)) {

			foreach ($this->category->children as $category) {



				// Show the horizontal seperator

				if ($iCol == 1 && $iCategory > $categories_per_row) {

					?>

					<div class="horizontal-separator"></div>

					<?php

				}



				// this is an indicator wether a row needs to be opened or not

				if ($iCol == 1) {

					?>

			<div class="row">

			<?php

				}



				// Show the vertical seperator

				if ($iCategory == $categories_per_row or $iCategory % $categories_per_row == 0) {

					$show_vertical_separator = ' ';

				} else {

					$show_vertical_separator = $verticalseparator;

				}



				// Category Link

				$caturl = JRoute::_ ('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category->virtuemart_category_id);



				// Show Category

				?>

				<div class="category floatleft<?php echo $category_cellwidth . $show_vertical_separator ?>">

					<div class="spacer">

						<h2>

							<a href="<?php echo $caturl ?>" title="<?php echo $category->category_name ?>">

								<?php echo $category->category_name ?>

								<br/>

								<?php // if ($category->ids) {

								echo $category->images[0]->displayMediaThumb ("", FALSE);

								//} ?>

							</a>

						</h2>

					</div>

				</div>

				<?php

				$iCategory++;



				// Do we need to close the current row now?

				if ($iCol == $categories_per_row) {

					?>

					<div class="clear"></div>

		</div>

			<?php

					$iCol = 1;

				} else {

					$iCol++;

				}

			}

		}

		// Do we need a final closing row tag?

		if ($iCol != 1) {

			?>

			<div class="clear"></div>

		</div>

	<?php } ?>

	</div>



	<?php

	}

}

?>

<div class="browse-view">

<?php

if (!empty($this->keyword)) {

	?>

<h3><?php echo $this->keyword; ?></h3>

	<?php

} ?>

<?php if ($this->search !== NULL) { ?>

<form action="<?php echo JRoute::_ ('index.php?option=com_virtuemart&view=category&limitstart=0&virtuemart_category_id=' . $this->category->virtuemart_category_id); ?>" method="get">



	<!--BEGIN Search Box -->

	<div class="virtuemart_search">

		<?php echo $this->searchcustom ?>

		<br/>

		<?php echo $this->searchcustomvalues ?>

		<input name="keyword" class="inputbox" type="text" size="20" value="<?php echo $this->keyword ?>"/>

		<input type="submit" value="<?php echo JText::_ ('COM_VIRTUEMART_SEARCH') ?>" class="button" onclick="this.form.keyword.focus();"/>

	</div>

	<input type="hidden" name="search" value="true"/>

	<input type="hidden" name="view" value="category"/>



</form>

<!-- End Search Box -->

	<?php } ?>



<?php // Show child categories

if (!empty($this->products)) {

	?>

<div class="orderby-displaynumber">

	<div class="width70 floatleft">

		<?php echo $this->orderByList['orderby']; ?>

		<?php echo $this->orderByList['manufacturer']; ?>

	</div>

	<div class="width30 floatright display-number"><?php echo $this->vmPagination->getResultsCounter ();?><br/><?php echo $this->vmPagination->getLimitBox (); ?></div>

	<div class="vm-pagination">

		<?php echo $this->vmPagination->getPagesLinks (); ?>

		<span style="float:right"><?php echo $this->vmPagination->getPagesCounter (); ?></span>

	</div>



	<div class="clear"></div>

</div> <!-- end of orderby-displaynumber -->



<h1><?php echo $this->category->category_name; ?></h1>



	<?php

	// Category and Columns Counter

	$iBrowseCol = 1;

	$iBrowseProduct = 1;



	// Calculating Products Per Row

	$BrowseProducts_per_row = $this->perRow;

	$Browsecellwidth = ' width' . floor (100 / $BrowseProducts_per_row);



	// Separator

	$verticalseparator = " vertical-separator";



	// Count products ?? why not just count ($this->products)  ?? note by Max Milbers

	$BrowseTotalProducts = 0;

	foreach ($this->products as $product) {

		$BrowseTotalProducts++;

	}



	// Start the Output

	foreach ($this->products as $product) {



		// Show the horizontal seperator

		if ($iBrowseCol == 1 && $iBrowseProduct > $BrowseProducts_per_row) {

			?>

		<div class="horizontal-separator"></div>

			<?php

		}



		// this is an indicator wether a row needs to be opened or not

		if ($iBrowseCol == 1) {

			?>

	<div class="row">

	<?php

		}



		// Show the vertical seperator

		if ($iBrowseProduct == $BrowseProducts_per_row or $iBrowseProduct % $BrowseProducts_per_row == 0) {

			$show_vertical_separator = ' ';

		} else {

			$show_vertical_separator = $verticalseparator;

		}



		// Show Products

		?>
?>



<div class="productdetails-view productdetails">



    <?php

    // Product Navigation

    if (VmConfig::get('product_navigation', 1)) {

	?>

        <div class="product-neighbours">

	    <?php

	    if (!empty($this->product->neighbours ['previous'][0])) {

		$prev_link = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->product->neighbours ['previous'][0] ['virtuemart_product_id'] . '&virtuemart_category_id=' . $this->product->virtuemart_category_id);

		echo JHTML::_('link', $prev_link, $this->product->neighbours ['previous'][0]

			['product_name'], array('class' => 'previous-page'));

	    }

	    if (!empty($this->product->neighbours ['next'][0])) {

		$next_link = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->product->neighbours ['next'][0] ['virtuemart_product_id'] . '&virtuemart_category_id=' . $this->product->virtuemart_category_id);

		echo JHTML::_('link', $next_link, $this->product->neighbours ['next'][0] ['product_name'], array('class' => 'next-page'));

	    }

	    ?>

    	<div class="clear"></div>

        </div>

    <?php } // Product Navigation END

    ?>



	<?php // Back To Category Button

	if ($this->product->virtuemart_category_id) {

		$catURL =  JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$this->product->virtuemart_category_id);

		$categoryName = $this->product->category_name ;

	} else {

		$catURL =  JRoute::_('index.php?option=com_virtuemart');

		$categoryName = jText::_('COM_VIRTUEMART_SHOP_HOME') ;

	}

	?>

	<div class="back-to-category">

    	<a href="<?php echo $catURL ?>" class="product-details" title="<?php echo $categoryName ?>"><?php echo JText::sprintf('COM_VIRTUEMART_CATEGORY_BACK_TO',$categoryName) ?></a>

	</div>



    <?php // Product Title   ?>

    <h1><?php echo $this->product->product_name ?></h1>

    <?php // Product Title END   ?>



    <?php // afterDisplayTitle Event

    echo $this->product->event->afterDisplayTitle ?>



    <?php

    // Product Edit Link

    echo $this->edit_link;

    // Product Edit Link END

    ?>



    <?php

    // PDF - Print - Email Icon

    if (VmConfig::get('show_emailfriend') || VmConfig::get('show_printicon') || VmConfig::get('pdf_button_enable')) {

	?>

        <div class="icons">

	    <?php

	    //$link = (JVM_VERSION===1) ? 'index2.php' : 'index.php';

	    $link = 'index.php?tmpl=component&option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->product->virtuemart_product_id;

	    $MailLink = 'index.php?option=com_virtuemart&view=productdetails&task=recommend&virtuemart_product_id=' . $this->product->virtuemart_product_id . '&virtuemart_category_id=' . $this->product->virtuemart_category_id . '&tmpl=component';



	    if (VmConfig::get('pdf_icon', 1) == '1') {

		echo $this->linkIcon($link . '&format=pdf', 'COM_VIRTUEMART_PDF', 'pdf_button', 'pdf_button_enable', false);

	    }

	    echo $this->linkIcon($link . '&print=1', 'COM_VIRTUEMART_PRINT', 'printButton', 'show_printicon');

	    echo $this->linkIcon($MailLink, 'COM_VIRTUEMART_EMAIL', 'emailButton', 'show_emailfriend');

	    ?>

    	<div class="clear"></div>

        </div>

    <?php } // PDF - Print - Email Icon END

    ?>



    <?php

    // Product Short Description

    if (!empty($this->product->product_s_desc)) {

	?>

        <div class="product-short-description">

	    <?php

	    /** @todo Test if content plugins modify the product description */

	    echo nl2br($this->product->product_s_desc);

	    ?>

        </div>

	<?php

    } // Product Short Description END





    if (!empty($this->product->customfieldsSorted['ontop'])) {

	$this->position = 'ontop';

	echo $this->loadTemplate('customfields');

    } // Product Custom ontop end

    ?>



    <div>

	<div class="width60 floatleft">

<?php


echo $this->loadTemplate('images');

?>

	</div>



	<div class="width40 floatright">

	    <div class="spacer-buy-area">



		<?php

		// TODO in Multi-Vendor not needed at the moment and just would lead to confusion

		/* $link = JRoute::_('index2.php?option=com_virtuemart&view=virtuemart&task=vendorinfo&virtuemart_vendor_id='.$this->product->virtuemart_vendor_id);

		  $text = JText::_('COM_VIRTUEMART_VENDOR_FORM_INFO_LBL');

		  echo '<span class="bold">'. JText::_('COM_VIRTUEMART_PRODUCT_DETAILS_VENDOR_LBL'). '</span>'; ?><a class="modal" href="<?php echo $link ?>"><?php echo $text ?></a><br />

		 */

		?>



		<?php

		if ($this->showRating) {

		    $maxrating = VmConfig::get('vm_maximum_rating_scale', 5);



		    if (empty($this->rating)) {

			?>

			<span class="vote"><?php echo JText::_('COM_VIRTUEMART_RATING') . ' ' . JText::_('COM_VIRTUEMART_UNRATED') ?></span>

			    <?php

			} else {

			    $ratingwidth = $this->rating->rating * 24; //I don't use round as percetntage with works perfect, as for me

			    ?>

			<span class="vote">

	<?php echo JText::_('COM_VIRTUEMART_RATING') . ' ' . round($this->rating->rating) . '/' . $maxrating; ?><br/>

			    <span title=" <?php echo (JText::_("COM_VIRTUEMART_RATING_TITLE") . round($this->rating->rating) . '/' . $maxrating) ?>" class="ratingbox" style="display:inline-block;">

				<span class="stars-orange" style="width:<?php echo $ratingwidth.'px'; ?>">

				</span>

			    </span>

			</span>

			<?php

		    }

		}

		if (is_array($this->productDisplayShipments)) {

		    foreach ($this->productDisplayShipments as $productDisplayShipment) {

			echo $productDisplayShipment . '<br />';

		    }

		}

		if (is_array($this->productDisplayPayments)) {

		    foreach ($this->productDisplayPayments as $productDisplayPayment) {

			echo $productDisplayPayment . '<br />';

		    }

		}

		// Product Price

		    // the test is done in show_prices

		//if ($this->show_prices and (empty($this->product->images[0]) or $this->product->images[0]->file_is_downloadable == 0)) {

		    echo $this->loadTemplate('showprices');

		//}

		?>



		<?php

		// Add To Cart Button

// 			if (!empty($this->product->prices) and !empty($this->product->images[0]) and $this->product->images[0]->file_is_downloadable==0 ) {

//		if (!VmConfig::get('use_as_catalog', 0) and !empty($this->product->prices['salesPrice'])) {

		    echo $this->loadTemplate('addtocart');

//		}  // Add To Cart Button END

		?>



		<?php

		// Availability Image

		$stockhandle = VmConfig::get('stockhandle', 'none');

		if (($this->product->product_in_stock - $this->product->product_ordered) < 1) {

			if ($stockhandle == 'risetime' and VmConfig::get('rised_availability') and empty($this->product->product_availability)) {

			?>	<div class="availability">

			    <?php echo (file_exists(JPATH_BASE . DS . VmConfig::get('assets_general_path') . 'images/availability/' . VmConfig::get('rised_availability'))) ? JHTML::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' . VmConfig::get('rised_availability', '7d.gif'), VmConfig::get('rised_availability', '7d.gif'), array('class' => 'availability')) : VmConfig::get('rised_availability'); ?>

			</div>

		    <?php

			} else if (!empty($this->product->product_availability)) {

			?>

			<div class="availability">

			<?php echo (file_exists(JPATH_BASE . DS . VmConfig::get('assets_general_path') . 'images/availability/' . $this->product->product_availability)) ? JHTML::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' . $this->product->product_availability, $this->product->product_availability, array('class' => 'availability')) : $this->product->product_availability; ?>

			</div>

			<?php

			}

		}

		?>



<?php

// Ask a question about this product

if (VmConfig::get('ask_question', 1) == 1) {

    ?>

    		<div class="ask-a-question">


    		    <a class="ask-a-question" href="<?php echo $this->askquestion_url ?>" ><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL') ?></a>

    		    <!--<a class="ask-a-question modal" rel="{handler: 'iframe', size: {x: 700, y: 550}}" href="<?php echo $this->askquestion_url ?>"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL') ?></a>-->

    		</div>

		<?php }

		?>



		<?php

		// Manufacturer of the Product

		if (VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) {

		    echo $this->loadTemplate('manufacturer');

		}

		?>



	    </div>

	</div>

	<div class="clear"></div>

    </div>



	<?php // event onContentBeforeDisplay

	echo $this->product->event->beforeDisplayContent; ?>



	<?php

	// Product Description

	if (!empty($this->product->product_desc)) {

	    ?>

        <div class="product-description">

	<?php /** @todo Test if content plugins modify the product description */ ?>

    	<span class="title"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DESC_TITLE') ?></span>

	<?php echo $this->product->product_desc; ?>

        </div>

	<?php

    } // Product Description END



    if (!empty($this->product->customfieldsSorted['normal'])) {

	$this->position = 'normal';

	echo $this->loadTemplate('customfields');

    } // Product custom_fields END

    // Product Packaging

    $product_packaging = '';

    if ($this->product->product_box) {

	?>

        <div class="product-box">

	    <?php

	        echo JText::_('COM_VIRTUEMART_PRODUCT_UNITS_IN_BOX') .$this->product->product_box;

	    ?>

        </div>

    <?php } // Product Packaging END

    ?>



    <?php

    // Product Files

    // foreach ($this->product->images as $fkey => $file) {

    // Todo add downloadable files again

    // if( $file->filesize > 0.5) $filesize_display = ' ('. number_format($file->filesize, 2,',','.')." MB)";

    // else $filesize_display = ' ('. number_format($file->filesize*1024, 2,',','.')." KB)";



    /* Show pdf in a new Window, other file types will be offered as download */

    // $target = stristr($file->file_mimetype, "pdf") ? "_blank" : "_self";

    // $link = JRoute::_('index.php?view=productdetails&task=getfile&virtuemart_media_id='.$file->virtuemart_media_id.'&virtuemart_product_id='.$this->product->virtuemart_product_id);

    // echo JHTMl::_('link', $link, $file->file_title.$filesize_display, array('target' => $target));

    // }

    if (!empty($this->product->customfieldsRelatedProducts)) {

	echo $this->loadTemplate('relatedproducts');

    } // Product customfieldsRelatedProducts END



    if (!empty($this->product->customfieldsRelatedCategories)) {

	echo $this->loadTemplate('relatedcategories');

    } // Product customfieldsRelatedCategories END

    // Show child categories

    if (VmConfig::get('showCategory', 1)) {

	echo $this->loadTemplate('showcategory');

    }

    if (!empty($this->product->customfieldsSorted['onbot'])) {

    	$this->position='onbot';

    	echo $this->loadTemplate('customfields');

    } // Product Custom ontop end

    ?>



<?php // onContentAfterDisplay event

echo $this->product->event->afterDisplayContent; ?>



<?php

echo $this->loadTemplate('reviews');

?>

</div>
		<div class="product floatleft<?php echo $Browsecellwidth . $show_vertical_separator ?>">

			<div class="spacer">

				<div class="width30 floatleft center">

				    <a title="<?php echo $product->link ?>" rel="vm-additional-images" href="<?php echo $product->link; ?>">

						<?php

							echo $product->images[0]->displayMediaThumb('class="browseProductImage"', false);

						?>

					 </a>



					<!-- The "Average Customer Rating" Part -->

					<?php if ($this->showRating) { ?>

					<span class="contentpagetitle"><?php echo JText::_ ('COM_VIRTUEMART_CUSTOMER_RATING') ?>:</span>

					<br/>

					<?php

					// $img_url = JURI::root().VmConfig::get('assets_general_path').'/reviews/'.$product->votes->rating.'.gif';

					// echo JHTML::image($img_url, $product->votes->rating.' '.JText::_('COM_VIRTUEMART_REVIEW_STARS'));

					// echo JText::_('COM_VIRTUEMART_TOTAL_VOTES').": ". $product->votes->allvotes;

					?>

					<?php } ?>

 					<?php

						if ( VmConfig::get ('display_stock', 1)) { ?>

						<!-- 						if (!VmConfig::get('use_as_catalog') and !(VmConfig::get('stockhandle','none')=='none')){?> -->

						<div class="paddingtop8">

							<span class="vmicon vm2-<?php echo $product->stock->stock_level ?>" title="<?php echo $product->stock->stock_tip ?>"></span>

							<span class="stock-level"><?php echo JText::_ ('COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_TITLE_TIP') ?></span>

						</div>

						<?php } ?>

				</div>



				<div class="width70 floatright">



					<h2><?php echo JHTML::link ($product->link, $product->product_name); ?></h2>



					<?php // Product Short Description

					if (!empty($product->product_s_desc)) {

						?>

						<p class="product_s_desc">

							<?php echo shopFunctionsF::limitStringByWord ($product->product_s_desc, 40, '...') ?>

						</p>

						<?php } ?>



					<div class="product-price marginbottom12" id="productPrice<?php echo $product->virtuemart_product_id ?>">

						<?php

						if ($this->show_prices == '1') {

							if ($product->prices['salesPrice']<=0 and VmConfig::get ('askprice', 1) and  !$product->images[0]->file_is_downloadable) {

								echo JText::_ ('COM_VIRTUEMART_PRODUCT_ASKPRICE');

							}

							//todo add config settings

							if ($this->showBasePrice) {

								echo $this->currency->createPriceDiv ('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $product->prices);

								echo $this->currency->createPriceDiv ('basePriceVariant', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT', $product->prices);

							}

							echo $this->currency->createPriceDiv ('variantModification', 'COM_VIRTUEMART_PRODUCT_VARIANT_MOD', $product->prices);

							if (round($product->prices['basePriceWithTax'],$this->currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) {

								echo '<span class="price-crossed" >' . $this->currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $product->prices) . "</span>";

							}

							if (round($product->prices['salesPriceWithDiscount'],$this->currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) {

								echo $this->currency->createPriceDiv ('salesPriceWithDiscount', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT', $product->prices);

							}

							echo $this->currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);

							echo $this->currency->createPriceDiv ('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices);

							echo $this->currency->createPriceDiv ('discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $product->prices);

							echo $this->currency->createPriceDiv ('taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $product->prices);

							$unitPriceDescription = JText::sprintf ('COM_VIRTUEMART_PRODUCT_UNITPRICE', $product->product_unit);

							echo $this->currency->createPriceDiv ('unitPrice', $unitPriceDescription, $product->prices);

						} ?>



					</div>



					<p>
<!--Add to cart button BEGIN-->
<form method="post" class="product" action="index.php" id="addtocartproduct<?php echo $product->virtuemart_product_id ?>">
   <div class="addtocart-bar">
      <?php // Display the quantity box ?>
      <!-- <label for="quantity<?php echo $this->product->virtuemart_product_id;?>" class="quantity_box"><?php echo JText::_('COM_VIRTUEMART_CART_QUANTITY'); ?>: </label> -->
      <span class="quantity-box">
         <input style="display:none;" type="text" class="quantity-input" name="quantity[]" value="1" />
      </span>
                        
      <?php // Display the quantity box END ?>

      <?php // Add the button
         $button_lbl = JText::_('COM_VIRTUEMART_CART_ADD_TO');
         $button_cls = ''; //$button_cls = 'addtocart_button';
         if (VmConfig::get('check_stock') == '1' && !$this->product->product_in_stock) {
            $button_lbl = JText::_('COM_VIRTUEMART_CART_NOTIFY');
            $button_cls = 'notify-button';
      } ?>

      <?php // Display the add to cart button ?>
      <span class="addtocart-button">
         <input type="submit" name="addtocart"  class="addtocart-button" value="<?php echo $button_lbl ?>" title="<?php echo $button_lbl ?>" />
      </span>

      <div class="clear"></div>
   </div>

   <?php // Display the add to cart button END ?>
   <input type="hidden" class="pname" value="<?php echo $product->product_name ?>">
   <input type="hidden" name="option" value="com_virtuemart" />
   <input type="hidden" name="view" value="cart" />
   <noscript><input type="hidden" name="task" value="add" /></noscript>
   <input type="hidden" name="virtuemart_product_id[]" value="<?php echo $product->virtuemart_product_id ?>" />
   <?php /** @todo Handle the manufacturer view */ ?>
   <input type="hidden" name="virtuemart_manufacturer_id" value="<?php echo $product->virtuemart_manufacturer_id ?>" />
   <input type="hidden" name="virtuemart_category_id[]" value="<?php echo $product->virtuemart_category_id ?>" />
</form><!--Add to cart button END-->

					</p>



				</div>

				<div class="clear"></div>

			</div>

			<!-- end of spacer -->

		</div> <!-- end of product -->

		<?php



		// Do we need to close the current row now?

		if ($iBrowseCol == $BrowseProducts_per_row || $iBrowseProduct == $BrowseTotalProducts) {

			?>

			<div class="clear"></div>

   </div> <!-- end of row -->

			<?php

			$iBrowseCol = 1;

		} else {

			$iBrowseCol++;

		}



		$iBrowseProduct++;

	} // end of foreach ( $this->products as $product )

	// Do we need a final closing row tag?

	if ($iBrowseCol != 1) {

		?>

	<div class="clear"></div>



		<?php

	}

	?>



<div class="vm-pagination"><?php echo $this->vmPagination->getPagesLinks (); ?><span style="float:right"><?php echo $this->vmPagination->getPagesCounter (); ?></span></div>



	<?php

} elseif ($this->search !== NULL) {

	echo JText::_ ('COM_VIRTUEMART_NO_RESULT') . ($this->keyword ? ' : (' . $this->keyword . ')' : '');

}

?>

</div><!-- end browse-view -->